package com.kuizii.server.discovery;

import com.kuizii.common.LiteServiceRegistration;
import com.kuizii.common.net.EventType;
import org.springframework.context.ApplicationEvent;


import java.util.function.Function;


/**
 * @author renxiaodong
 */
public class RegisterEvent extends ApplicationEvent {

    /**
     * Constructs a prototypical Event.
     *
     * @param eventType
     * @throws IllegalArgumentException if source is null.
     */
    public RegisterEvent(EventType eventType, LiteServiceRegistration registration) {
        super(eventType);

        this.eventType = eventType;
        this.registration = registration;

    }


    public EventType getEventType() {
        return eventType;
    }

    public void setEventType(EventType eventType) {
        this.eventType = eventType;
    }

    public Function getCallBack() {
        return callBack;
    }

    public void setCallBack(Function eventHandler) {
        this.callBack = callBack;
    }

    EventType eventType;

    Function callBack;

    public LiteServiceRegistration getRegistration() {
        return registration;
    }

    public void setRegistration(LiteServiceRegistration registration) {
        this.registration = registration;
    }

    LiteServiceRegistration registration;

    /**
     * Constructs a prototypical Event.
     *
     * @param source The object on which the Event initially occurred.
     * @throws IllegalArgumentException if source is null.
     */
    public RegisterEvent(Object source) {
        super(source);
    }
}
